home *** CD-ROM | disk | FTP | other *** search
- /* Personality module for MCM 1.1e */
-
- /* Modify the routines in this module to suit your needs, but make */
- /* sure that you include all of the listed subroutines. If you send */
- /* me (msawyer@mael.soest.hawaii.edu) your personality files, I will */
- /* try to get as many included in the distribution as possible, but */
- /* make no promises. You may redistribute modified versions of this */
- /* file. */
-
- /* This is a _SAMPLE_ Shadowrun style personality. Because I do not */
- /* know the mechanics of Shadowrun, all that is included is a short */
- /* routine to handle the dice-rolling system used there. */
-
- #include "mcm.h"
-
- int shadowroll;
-
- /* General purpose initialization routine. Called as soon as the */
- /* port is initialized. */
-
- void per_init()
- {
- }
-
- /* Define a new signal processor for SIG_USR2. There really isn't */
- /* that much need for this, but it is here in case you want it. */
-
- void per_sig2()
- {
- }
-
- /* Define a routine to be run once per each time step */
-
- void per_timestep()
- {
- }
-
- /* Define a pre-processor for the tell() call. You may modify the */
- /* system and/or text fields, and should return TRUE if you want the */
- /* tell() to continue, or FALSE to fall out. */
-
- int per_tell(msgfrom, msgto, system, text)
- int msgfrom, msgto;
- char *system, *text;
- {
- return (TRUE);
- }
-
- /* Define a pre-processor for the process() call. You may call any */
- /* mcm or personality subroutines here and/or modify the command */
- /* variable. Again, returning TRUE allows the process() to continue */
-
- int per_process(msgfrom, command)
- int msgfrom;
- char *command;
- {
- return (TRUE);
- }
-
- /* Define a special processor to be run after each successful login */
- /* attempt. */
-
- void per_login(msgfrom)
- int msgfrom;
- {
- }
-
- /* Define a short routine to document any additional * and / commands */
- /* added by the per_process() call. TRUE continues with the normal */
- /* help messages */
-
- int per_slashhelp(msgfrom)
- int msgfrom;
- {
- return (TRUE);
- }
-
- int per_starhelp(msgfrom)
- int msgfrom;
- {
- return (TRUE);
- }
-
- /* Now get additional mode help text */
-
- int per_modehelp(msgfrom)
- int msgfrom;
- {
- return (TRUE);
- }
-
- /* Define a pre-processor for the mode (*M) commands. Again, you may */
- /* modify the command field, and returning TRUE runs the normal mode */
- /* commands on the modified text */
-
- int per_mode(msgfrom, command)
- int msgfrom;
- char *command;
- {
- return (TRUE);
- }
-
- /* Define a set of processes to be called before and after rolling */
- /* the dice. You may, in per_preroll() evaluate a modified roll */
- /* command (ie: /RH for roll to hit), modifying the command text to a */
- /* appropriate roll command (/Rd20). You may then, in per_postroll() */
- /* modify the output string to a more appropriate message (ie: Hit */
- /* AC3). If either routine returns FALSE, roll() will terminate, */
- /* assuming that the personality mode took care of the rest. */
-
- int per_preroll(job, command)
- int job;
- char *command;
- {
- return(TRUE);
- }
-
- int per_postroll(pubroll, job, res_text, res_val, number, sides, rolls)
- int pubroll, job, res_val, number, sides;
- char *res_text;
- int rolls[20];
- {
- int i, anyhits;
- char newstring[80];
-
- anyhits=1;
- while (anyhits==1)
- {
- anyhits=0;
- for (i=0;i<number;i++)
- {
- if (rolls[i]==sides)
- {
- rolls[i]=lrand48()%sides;
- rolls[i]++;
- anyhits=1;
- }
- else
- rolls[i]=0;
- }
- if (anyhits==1)
- {
- strcat (res_text," [");
- for (i=0;i<number;i++)
- {
- if (rolls[i]!=0)
- {
- sprintf (newstring,"+%d",rolls[i]);
- strcat (res_text,newstring);
- res_val+=rolls[i];
- }
- }
- sprintf (newstring,"]=%d",res_val);
- strcat (res_text,newstring);
- }
- }
- return (TRUE);
- }
-
- /* And finally a special process to be run when a user logs out. */
- void per_logout(msgfrom)
- int msgfrom;
- {
- }
-
-